# Contributor: Oleg Titov <oleg.titov@gmail.com>
# Maintainer: Oleg Titov <oleg.titov@gmail.com>
pkgname=py3-thinc
pkgver=8.2.2
pkgrel=0
pkgdesc="Practical Machine Learning for NLP"
url="https://github.com/explosion/thinc"
arch="x86_64 x86"
license="MIT"
depends="
	py3-blis
	py3-catalogue
	py3-cymem
	py3-murmurhash
	py3-plac
	py3-preshed
	py3-srsly
	py3-wasabi
	python3
	"
makedepends="
	cython
	py3-gpep517
	py3-numpy-dev
	py3-setuptools
	py3-wheel
	python3-dev
	"
checkdepends="
	py3-confection
	py3-hypothesis
	py3-mock
	py3-numpy
	py3-pytest
	py3-pytest-xdist
	py3-tqdm
	"
subpackages="$pkgname-doc $pkgname-pyc"
source="thinc-$pkgver.tar.gz::https://github.com/explosion/thinc/archive/v$pkgver.tar.gz"
builddir="$srcdir/thinc-$pkgver"

build() {
	CFLAGS="$CFLAGS -flto=auto" \
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl

	# hack around an import failure due to relative dirs
	local installdir="$(echo $PWD/.testenv/lib/python3*/site-packages/)"
	cd "$installdir"
	../../../bin/python3 -m pytest thinc -n auto
}

package() {
	python -m installer -d "$pkgdir" .dist/*.whl

	install -Dm644 README.md -t "$pkgdir/usr/share/doc/$pkgname/"

	rm -r "$pkgdir"/usr/lib/python3*/site-packages/thinc/tests/
}

sha512sums="
4cf41bbc0d4fb7e2c990533644516968dd9ecba405bdbd24b60e77e07ecddffc838733a200faf7e177be83dfd517ed82e7942d5929d9908a4269662c357314bb  thinc-8.2.2.tar.gz
"
